#ifndef REQUESTFIFO_H_
#define REQUESTFIFO_H_

#include <string>
#include <cerrno>
#include "SharedRecord.h"
#include "LogFile.h"

using namespace std;

class RequestFifo {

private:
	string name;
	int fd;
	int dummyFd;
	bool isDestroyed;

	LogFile* logFile;

    void closeFDs();

	// Para usar en los logs.
	static string convertToString(int value);

public:
	RequestFifo(string fileName, LogFile* logFile);
	virtual ~RequestFifo();

	bool writeRequest(SharedRecord request);
	bool readRequest(SharedRecord &request);

	void destroy();
};

#endif /* REQUESTFIFO_H_ */
